package com.magoldeditor.view;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Iterator;
import com.magoldeditor.controller.MaEditorMouseListener;
import com.magoldeditor.controller.MaEditorMouseMotionListener;
import com.magoldeditor.model.IPainter;

/**
 * 
 * @author Velconia
 * @version v.3.0
 * 
 */
public class DisplayPanel extends MaEditorPanel {
	
	/**
	 * serial version UID
	 */
	private static final long serialVersionUID = 5L;
	
	/**
	 * 
	 */
	public DisplayPanel(){
		super(null, null, null, null);
	}
	
	/**
	 * 
	 * @param name
	 */
	public DisplayPanel(String name) {
		super(null, null, null, name);
	}
	
	/**
	 * 
	 * @param color
	 * @param name
	 */
	public DisplayPanel(Color color, String name) {
		super(color, null, null, name);
	}
	
	/**
	 * 
	 * @param color
	 * @param mouseMotionListener
	 * @param mouseListener
	 * @param name
	 */
	public DisplayPanel(Color color, MaEditorMouseMotionListener mouseMotionListener, MaEditorMouseListener mouseListener, String name) {
		super(color, mouseMotionListener, mouseListener, name);
	}
	
	@Override
	public void paint(Graphics g) {
		g.setColor(this.color);
		g.fillRect(0, 0, this.getWidth(), this.getHeight());
		
		paintLine(g, this);
		
		if (painterList != null) {
			Iterator<IPainter> iterator = painterList.iterator();
			while (iterator.hasNext()) {
				iterator.next().paintMethod(g);
			}
		}
	}
}
